package com.supinfo.suptracking.service;

import com.supinfo.suptracking.dao.UserDao;
import com.supinfo.suptracking.entity.Car;
import com.supinfo.suptracking.entity.Invoice;
import com.supinfo.suptracking.entity.User;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import java.util.List;

/**
 *
 * @author Fabien, Jérémy, Ludovic, Brice
 */

@Stateless
public class UserService {
    
    @EJB
    private UserDao userDao;

    public void processAddUser(User user) {
        userDao.addUser(user);
    }
    
    public void processDelUser(User user) {
        userDao.delUser(user);
    }
    
    public void processDelUser(Long userId) {
        userDao.delUser(userId);
    }    
    public List<User> processGetAllUser() {
        return userDao.getAllUser();
    }
    
    public User processGetUserByCar(Car car) {
        return userDao.getUserByCar(car);
    }
    
    public User processGetUserByInvoice(Invoice invoice) {
        return userDao.getUserByInvoice(invoice);
    }
    
    public void processUpdateUser(User user) {
        userDao.updateUser(user);
    }
    
    public boolean processIsAdmin(User user) {
        return userDao.isAdminUser(user);
    }
    
    public User processGetUserByUsername(String username) {
        return userDao.getUserByUsername(username);
    }
    
    public User processGetUserByMail(String mail) {
        return userDao.getUserByMail(mail);
    }
}
